package team.stride.tabs.home;

import team.stride.R;
import team.stride.tabs.TabGroupActivity;
import team.stride.utils.UtilsStride;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class FinalResultsActivity extends Activity {

	private Button backBtn;
	private TextView distanceTV;
	private TextView timeTV;
	private TextView speedTV;

	// private TextView caloriesTV;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.final_results_layout);
		// UtilsStride.newTrack = true;

		backBtn = (Button) findViewById(R.id.backHomeB);
		distanceTV = (TextView) findViewById(R.id.finalDistance);
		timeTV = (TextView) findViewById(R.id.finalTime);
		speedTV = (TextView) findViewById(R.id.finalSpeed);
		// caloriesTV = (TextView) findViewById(R.id.finalCalories);

		distanceTV.setText((float) UtilsStride.totalDistance / 1000 + " Km");
		timeTV.setText(UtilsStride.totalTime / 1000 + " s");

		speedTV.setText((float) UtilsStride.totalDistance
				/ ((float) UtilsStride.totalTime / 3600) + " Km/h");

		backBtn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				final TabGroupActivity parentActivity = (TabGroupActivity) getParent();
				Intent intent = new Intent(getParent(), HomeActivity.class);
				parentActivity.startChildActivity("HomeActivity", intent);
			}
		});

	}
}
